var e = require("../../../uv-ui-tools/libs/mixin/mpMixin.js"), t = require("../../../uv-ui-tools/libs/mixin/mixin.js"), n = require("./props.js"), i = require("../../../../common/vendor.js");

require("../../../uv-ui-tools/libs/function/index.js"), require("../../../uv-ui-tools/libs/function/test.js"), 
require("../../../uv-ui-tools/libs/function/digit.js"), require("../../../uv-ui-tools/libs/util/route.js"), 
require("../../../uv-ui-tools/libs/function/debounce.js"), require("../../../uv-ui-tools/libs/function/throttle.js");

var o = {
    name: "uv-textarea",
    mixins: [ e.mpMixin, t.mixin, n.props ],
    data: function() {
        return {
            innerValue: "",
            focused: !1,
            innerFormatter: function(e) {
                return e;
            }
        };
    },
    created: function() {
        this.innerValue = this.modelValue;
    },
    watch: {
        value: function(e) {
            this.innerValue = e;
        },
        modelValue: function(e) {
            this.innerValue = e;
        }
    },
    computed: {
        textareaClass: function() {
            var e = [], t = this.border, n = this.disabled;
            return "surround" === t && (e = e.concat([ "uv-border", "uv-textarea--radius" ])), 
            "bottom" === t && (e = e.concat([ "uv-border-bottom", "uv-textarea--no-radius" ])), 
            n && e.push("uv-textarea--disabled"), e.join(" ");
        },
        textareaStyle: function() {
            return this.$uv.deepMerge({}, this.$uv.addStyle(this.customStyle));
        },
        maxlen: function() {
            return this.maxlength < 0 ? this.maxlength < 0 ? -1 : 140 : this.maxlength;
        },
        getCount: function() {
            try {
                return this.innerValue.length > this.maxlen ? this.maxlen : this.innerValue.length;
            } catch (e) {
                e = VM2_INTERNAL_STATE_DO_NOT_USE_OR_PROGRAM_WILL_FAIL.handleException(e);
                return 0;
            }
        }
    },
    methods: {
        setFormatter: function(e) {
            this.innerFormatter = e;
        },
        onFocus: function(e) {
            this.$emit("focus", e);
        },
        onBlur: function(e) {
            this.$emit("blur", e), this.$uv.formValidate(this, "blur");
        },
        onLinechange: function(e) {
            this.$emit("linechange", e);
        },
        onInput: function(e) {
            var t = this, n = (e.detail || {}).value, i = void 0 === n ? "" : n, o = (this.formatter || this.innerFormatter)(i);
            this.innerValue = i, this.$nextTick(function() {
                t.innerValue = o, t.valueChange();
            });
        },
        valueChange: function() {
            var e = this, t = this.innerValue;
            this.$nextTick(function() {
                e.$emit("input", t), e.$emit("update:modelValue", t), e.$emit("change", t), e.$uv.formValidate(e, "change");
            });
        },
        onConfirm: function(e) {
            this.$emit("confirm", e);
        },
        onKeyboardheightchange: function(e) {
            this.$emit("keyboardheightchange", e);
        }
    }
}, r = i._export_sfc(o, [ [ "render", function(e, t, n, o, r, u) {
    return i.e({
        a: r.innerValue,
        b: i.s({
            height: e.autoHeight ? "auto" : e.$uv.addUnit(e.height)
        }),
        c: i.s(e.$uv.addStyle(e.textStyle)),
        d: e.placeholder,
        e: e.$uv.addStyle(e.placeholderStyle, "string"),
        f: e.placeholderClass,
        g: e.disabled,
        h: e.focus,
        i: e.autoHeight,
        j: e.fixed,
        k: e.cursorSpacing,
        l: e.cursor,
        m: e.showConfirmBar,
        n: e.selectionStart,
        o: e.selectionEnd,
        p: e.adjustPosition,
        q: e.disableDefaultPadding,
        r: e.holdKeyboard,
        s: u.maxlen,
        t: e.confirmType,
        v: e.ignoreCompositionEvent,
        w: e.confirmHold,
        x: i.o(function() {
            return u.onFocus && u.onFocus.apply(u, arguments);
        }),
        y: i.o(function() {
            return u.onBlur && u.onBlur.apply(u, arguments);
        }),
        z: i.o(function() {
            return u.onLinechange && u.onLinechange.apply(u, arguments);
        }),
        A: i.o(function() {
            return u.onInput && u.onInput.apply(u, arguments);
        }),
        B: i.o(function() {
            return u.onConfirm && u.onConfirm.apply(u, arguments);
        }),
        C: i.o(function() {
            return u.onKeyboardheightchange && u.onKeyboardheightchange.apply(u, arguments);
        }),
        D: e.count && -1 != u.maxlen
    }, e.count && -1 != u.maxlen ? {
        E: i.t(u.getCount),
        F: i.t(u.maxlen),
        G: i.s({
            "background-color": e.disabled ? "transparent" : "#fff"
        }),
        H: i.s(e.$uv.addStyle(e.countStyle))
    } : {}, {
        I: i.n(u.textareaClass),
        J: i.s(u.textareaStyle)
    });
} ], [ "__scopeId", "data-v-2ec10f78" ] ]);

wx.createComponent(r);